package 数据结构.查找编程作业;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @author IT_Jay
 * @date 2021/12/20 1:46 PM
 */
public class Test01 {
    private static List<Integer> list = new ArrayList<>();

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[Integer.parseInt(sc.nextLine())];

        String[] str = sc.nextLine().split(",");
        for (int i = 0; i < a.length; i++) {
            a[i] = Integer.parseInt(str[i]);
        }
        int k = sc.nextInt();
        int tmp = binarySearch(a, a.length, k);
        if (tmp != -1) {
            System.out.println(tmp);
        } else {
            System.out.println("no");
        }
        System.out.print(list.get(0));
        for (int i = 1; i < list.size(); i++) {
            System.out.print("," + list.get(i));
        }
    }

    static int binarySearch(int nums[], int length, int target) {
        int left = 0;
        int right = length - 1;
        while (left <= right) {
            int mid = (right + left) / 2;
            if (nums[mid] == target) {
                list.add(nums[mid]);
                return mid;
            } else if (nums[mid] < target) {
                left = mid + 1;
                list.add(nums[mid]);
            } else if (nums[mid] > target) {
                right = mid - 1;
                list.add(nums[mid]);
            }
        }
        return -1;
    }
}
